package com.lipaluma.xml.merge;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;

import com.lipaluma.field.merge.FieldMergedAlgorithmEnum;

@XmlType(name=XmlStrategyMerge.FIELD_MERGED)
@XmlAccessorType(XmlAccessType.FIELD)
public class XmlStrategyMerge implements XmlFieldMerged {
	public static final String FIELD_MERGED = "field-merged";
	
	@XmlAttribute(name="by", required=true)
	private FieldMergedAlgorithmEnum mergeAlgorithm;

	@XmlElement(name="param")
	private String[] params;

	@Override
	public FieldMergedAlgorithmEnum getAlgorithm() {
		return mergeAlgorithm;
	}

	@Override
	public String[] getParams() {
		if(this.params == null)
			return new String[0];
		return this.params;
	}

}
